package com.musiclibrary.services;

import java.util.List;

import com.musiclibrary.dao.IMusicCategoryDao;
import com.musiclibrary.persistence.MusicCategory;

public class MusicCategoryServiceImpl implements IMusicCategoryService{

	private IMusicCategoryDao musicCategoryDao;
	
	public IMusicCategoryDao getMusicCategoryDao() {
		return musicCategoryDao;
	}

	public void setMusicCategoryDao(IMusicCategoryDao musicCategoryDao) {
		this.musicCategoryDao = musicCategoryDao;
	}

	public void persist(MusicCategory musicCategory) {
		try {
			getMusicCategoryDao().persist(musicCategory);
		} catch (Exception e) {
			e.printStackTrace();
		}
		
	}

	public List<MusicCategory> loadAllMusicCategories() {
		List<MusicCategory> musicCategories=null;
		try{
			musicCategories=musicCategoryDao.loadAll();
		}catch(Exception e){
			e.printStackTrace();
		}
		return musicCategories;
	}

}
